From 16f6e2dd1fe372411d8f3a7808a3f6602a79d6f8 Mon Sep 17 00:00:00 2001 From: Debian Science Maintainers Date: Fri, 3 Jul 2026 22:13:01 +0100 Subject: [PATCH] Ignore errors (but not wrong results) of solve_power scipy.special.nctdtr returns NaN when rounding would otherwise make the result out of bounds: https://github.com/scipy/scipy/issues/25470 This has only been seen to fail the statsmodels test on armhf, but the underlying issue also exists on amd64 Author: Rebecca N. Palmer Forwarded: no Gbp-Pq: Name test_power_ignore_exception.patch --- statsmodels/stats/tests/test_power.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/statsmodels/stats/tests/test_power.py b/statsmodels/stats/tests/test_power.py index 5ae346f..d170b6d 100644 --- a/statsmodels/stats/tests/test_power.py +++ b/statsmodels/stats/tests/test_power.py @@ -83,8 +83,16 @@ class CheckPowerMixin: value = kwds[key] kwds[key] = None - result = self.cls().solve_power(**kwds) - assert_allclose(result, value, rtol=0.001, err_msg=key + " failed") + try: + result = self.cls().solve_power(**kwds) + except ValueError as err1: + # ignore failed brentq but not other errors + # not an xfail because we still want to try the other keys + print(key,value,kwds,err1) + if not "f(a) and f(b) must have different signs" in str(err1): + raise + else: + assert_allclose(result, value, rtol=0.001, err_msg=key + " failed") # yield can be used to investigate specific errors # yield assert_allclose, result, value, 0.001, 0, key+' failed' kwds[key] = value # reset dict -- 2.30.2